/**
 * 
 */
package in.ac.nitw.imageProcessor;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

/**
 * @author kislay
 * 
 */
public class ResizeTransformer implements ImageTransformer {

    private int width;

    private int height;

    /**
     * @return the width
     */
    public int getWidth() {
	return width;
    }

    /**
     * @param width
     *            the width to set
     */
    public void setWidth(int width) {
	this.width = width;
    }

    /**
     * @return the height
     */
    public int getHeight() {
	return height;
    }

    /**
     * @param height
     *            the height to set
     */
    public void setHeight(int height) {
	this.height = height;
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * in.ac.nitw.imageProcessor.ImageTransformer#applyTransformation(java.awt
     * .image.BufferedImage)
     */
    @Override
    public BufferedImage applyTransformation(BufferedImage image) {
	BufferedImage resizedImage = new BufferedImage(width, height,
		image.getType());
	Graphics2D g = resizedImage.createGraphics();
	g.drawImage(image, 0, 0, width, height, null);
	g.dispose();
	return resizedImage;
    }

}
